package p7;

/**
 * @author krystal
 * @date 2022/11/12 11:39
 */
class Shape{
    public void draw(){
        System.out.println("画图形");
    }
}

class Rect extends Shape{
    public void draw(){
        System.out.println("■");
    }
}

class Cycle extends Shape{
    public void draw(){
        System.out.println("●");
    }
}

class Triangle extends Shape{
    public void draw(){
        System.out.println("▲");
    }
}

public class Demo7 {
    public static void drawShapes(){
        Shape[] shapes={new Rect(),new Cycle(),new Triangle()};
        for (Shape shape:shapes){
            shape.draw();
        }
    }

    public static void main(String[] args) {
        drawShapes();
    }
}
